'use strict';
/**
 * @Controller 字典
 */
const Controller = require('egg').Controller;
const ModelName = 'Dict'
class DictController extends Controller {
     /**
   * @Router POST /dict/pages
   * @Request body number limit
   * @Request body number offset
   * @Summary 分页
   */
    async pages() {
        const { ctx } = this;
        const { limit = 20, offset=1 } = ctx.params
        const data = await ctx.service.sequelize.pages(ModelName,ctx.params)
        ctx.body = data;
    }
     /**
   * @Router POST /dict/save
   * @Request body number limit
   * @Request body number offset
   * @Summary 保存
   */
    async save(){
        const { ctx } = this;
        const data =  await ctx.service.sequelize.insert(ModelName,ctx.params)
        ctx.body = data
    }
     /**
   * @Router DELETE /dict/delete
   * @Request query number id
   * @Summary 删除
   */
    async delete(){
        const { ctx } = this;
        const data =  await ctx.service.sequelize.delete(ModelName,ctx.params)
        ctx.body = data
    }
     /**
   * @Router PUT /dict
   * @Request body number limit
   * @Request body number offset
   * @Summary 更新
   */
    async update(){
        const { ctx } = this;
        const data =  await ctx.service.sequelize.update(ModelName,ctx.params)
        ctx.body = data
    }
     /**
   * @Router GET /dict/list
   * @Request query number limit
   * @Summary list
   */
    async list(){
        const { ctx } = this;
        const data =  await ctx.service.sequelize.list(ModelName,ctx.params)
        ctx.body = data
    }
}

module.exports = DictController;